from datetime import datetime

from flask import Blueprint, render_template

# 创建蓝图时，第一个参数：name可以任意命名
# 第二个参数：必须使用__name__表示导包的名称
blue = Blueprint('userBlue',__name__)

@blue.route('find', methods=['GET'])
def find():
    return "<h2>hi,user - Blueprint</h2>"

# 1. 模块
@blue.route('/list',methods=['GET','POST'])
def listUser():
    data = {
        "message" : 'hello,template!',
        "age" : 20,
        "money" : 19999000.0354,
        "birthday": datetime.now(),
        "cate" : ["超级管理员", "系统管理员", "仓库管理员", "财务总监", "市场总监", "人力总监", "技术总监"],
        "script" : """
            <script>
                setTimeout( () => {document.write("haha");
                },1000)
            </script>
        """,
        "filesize" : 2*1024*1024 + 4990
    }
    return render_template("user/list.html", **data)

